/**
 * @author: HenryDai
 * @Date: 2022/05/01 19:19
 * @description:
 */
public class DoubleCheck {

    private volatile static DoubleCheck instance;

    DoubleCheck(){

    }

    /**
     *  双重校验锁实现单例模式, 线程安全
     * @return
     */
    public static DoubleCheck getInstance()
    {
        if(instance==null)
        {
            synchronized (DoubleCheck.class){
                if(instance==null)
                {
                    instance = new DoubleCheck();
                }
            }
        }
        return instance;
    }

}
